package cn.edu.sdjzu.usercenter.common;

import lombok.Data;

import java.io.Serializable;

/**
 * @projectName: user-center
 * @package: cn.edu.sdjzu.usercenter.common
 * @className: BaseResponse
 * @author: Liu
 * @description: 通用返回类
 * @date: 2024/3/28 22:11
 * @version: 1.0
 */
@Data
public class BaseResponse<T> implements Serializable {

    private int code;

    private T data;

    private String message;

    private String description;

    public BaseResponse(int code, T data, String message,String description) {
        this.code = code;
        this.data = data;
        this.message = message;
        this.description = description;
    }

    public BaseResponse(int code, T data,String message) {

        this(code,data,"","");
    }

    public BaseResponse(int code, T data) {

        this(code,data,"","");
    }

    public BaseResponse(ErrorCode errorCode){
        this(errorCode.getCode(),null,errorCode.getMessage(),errorCode.getDescription());
    }



}
